from yangke.common.fileOperate import read_excel, read_csv_ex
from yangke.base import interpolate_df, merge_two_dataframes

if __name__ == "__main__":
    # file1 = r'C:\Users\54067\Desktop\京能2022年1号机数据.xlsx'
    # file2 = r'C:\Users\54067\Desktop\华润2022年2号机间冷循环水数据.xlsx'
    # data1 = read_excel(file1, need_merge=True)
    # data2 = read_excel(file2, need_merge=True)
    # data1.dropna(how='any', axis=0, inplace=True)
    # data2.dropna(how='any', axis=0, inplace=True)
    # data1 = interpolate_df(data1, time_interval=300)
    # print("写出文件1")
    # data1.to_csv(r'C:\Users\54067\Desktop\京能2022年1号机数据_等间隔处理.csv')
    # data2 = interpolate_df(data2, time_interval=300)
    # print("写出文件2")
    # data2.to_csv(r'C:\Users\54067\Desktop\华润2022年2号机间冷循环水数据_等间隔处理.csv')

    file1 = r'C:\Users\54067\Desktop\京能2022年1号机数据_等间隔处理.csv'
    file2 = r'C:\Users\54067\Desktop\华润2022年2号机间冷循环水数据_等间隔处理.csv'

    data1 = read_csv_ex(file1)
    data2 = read_csv_ex(file2)
    data = merge_two_dataframes(data1, data2)[0]

    data['cond'] = data.apply(lambda x: '保留' if x['发电机实发功率'] > 640 and x['#1机组风速1'] >= 4 else '删除')

    print("..")
